import request from '@/common/js/request.js'

export default {
  
  // 轮播图
  getAdvertList(){
    return request({
      url:`/article/api/advert/show`
    })
  },
  
  // 查询分类与标签信息
  getCategoryList(){
    return request({
      url:'/article/api/category/label/list'
    })
  },
  
  getList(query, current = 1, size = 10){
    return request({
      url:'/course/api/course/search',
      method:'POST',
      data:{...query,current,size}
    })
  },
  
  //根据id查询课程详细信息
   getCourseDetail(id){
  	return request({
  		url:'/course/api/course/'+id,
  	})
  },
  
  //通过id查询课程章节信息
   getCourseSection(id){
  	return request({
  		url:'/course/api/chapter/section/list/'+id,
  	})
  },
  
  //通过id查询评论列表
   getCourseComment(id){
  	return request({
  		url:'/course/api/comment/list/'+id,
  	})
  },
  
  //通过id查询套餐
   getCoursePackage(id){
  	return request({
  		url:'/course/api/group/list/'+id,
  	})
  },

  //通过id查询套餐
   getCourseIsBuy(query){
  	return request({
  		url:`/course/course/is-bug?userId=${query.userId}&courseId=${query.courseId}`,
  	})
  },
  
  //通过groupId查询当前的套餐
   getGroupListbyId(id){
  	return request({
  		url:'/getGroupbyId/'+id,
  	})
  },
  
  //新增评论
   addCourseComment(data){
  	return request({
  		url:`/course/comment`,
      method:'POST',
      data
  	})
  }
  
}